package com.czm.art_light.controller;

import com.czm.art_light.constant.ApiRouterConsts;
import com.czm.art_light.constant.ArtErrorCodeEnum;
import com.czm.art_light.entity.ArtMovement;
import com.czm.art_light.param.request.ArtInfoReqDto;
import com.czm.art_light.param.request.PageReqDto;
import com.czm.art_light.param.response.ArtInfoRespDto;
import com.czm.art_light.param.response.ArtMovementBasicInfoRespDto;
import com.czm.art_light.param.response.RestResp;
import com.czm.art_light.service.ArtMovementService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 流派信息 API 控制器
 */
@Tag(name = "流派管理", description = "流派相关接口")
@RestController
@RequestMapping(ApiRouterConsts.MOVEMENTS_API_URL_PREFIX)
public class ArtMovementController {
    @Autowired
    private ArtMovementService artMovementService;

    /**
     * 获取流派信息 根据id以及分页的信息
     */
    @Operation(summary = "获取流派信息", description = "根据id以及分页的信息")
    @PostMapping("/getArtMovementById")
    public RestResp<ArtInfoRespDto> getArtMovementById(@Valid @RequestBody ArtInfoReqDto artInfoReqDto) {
        return RestResp.ok(artMovementService.getById(artInfoReqDto));

    }

    /**
     * 获取所有的流派信息
     */
    @Operation(summary = "获取所有的流派信息")
    @PostMapping("/getAllArtMovements")
    public RestResp<List<ArtMovementBasicInfoRespDto>> getAllArtMovements(@RequestBody PageReqDto pageReqDto) {
        List<ArtMovementBasicInfoRespDto> artMovements = artMovementService.list(pageReqDto);
        return RestResp.ok(artMovements);
    }
}
